<?php use_javascript('/SXShopCartPlugin/js/shopCartAdminOrders/main1.js') ?>

<?php use_javascript('/SXShopCartPlugin/js/shopCartAdminOrders/listOrders.js') ?>
<h2>Products List</h2>
<table class="table table-bordered table-striped adminGrid" summary="Meeting Results">
    <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Country</th>
            <th>City</th>
            <th>State</th>
            <th width="135">Date</th>
            <th width="146">Statues</th>
            <th width="95">Show Details</th>
        </tr>
    </thead>
    <tbody>
        <?php $orders = $pager->getResults() ?>
        <?php foreach ($orders as $order): ?>
            <tr>
                <td><?php echo $order->getId() ?></td>
                <td>
                    <a class="userDetails" href="<?php echo url_for('ShowUserDetails', array('oid' => $order->getId())) ?>"><?php echo $order->getFirstName() . ' ' . $order->getLastName() ?></a>
                </td>
                <td><?php echo $order->getCountry() ?></td>
                <td><?php echo $order->getCity() ?></td>
                <td><?php echo $order->getState() ?></td>
                <td><?php echo $order->getCreatedAt() ?></td>
                <td>
                    <form action="<?php echo url_for('@UpdateUserOrderStaurs?oid=' . $order->getId()) ?>" method="post">
                        <?php
                        $x    = new UserOrderStatuesForm(sfOutputEscaper::unescape($order));
                        echo $x->renderHiddenFields();
                        echo $x['order_status']->render(array('class' => 'order_statues left'));
                        ?>
                        <span class="loader" style="display: none"></span>
                    </form>
                </td>             
                <td><a class="showDetails" href="<?php echo url_for('ShowOrderDetails', array('oid' => $order->getId())) ?>">show details</a></td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<div id="detailsDialog" title="Order Details"></div>
<?php include_partial('shopCartAdminOrders/pager', array('pager'     => $pager, 'routeName' => 'shopCartAdminOrders/index')) ?>
